<template>
	<view class="container">
		<u--form ref="queryForm" :model="query">
			<u-form-item label="" prop="materialCode" style="display: flex;">
				<span style="margin-right: 20rpx;">物料码</span>
				<u--input 
					placeholder="请输入/扫描" 
					v-model="query.materialCode" 
					suffixIcon="scan" 
					suffixIconStyle="font-size: 68rpx"
					style="flex: 1;">
				</u--input>
			</u-form-item>
			<u-form-item label="" prop="materialBatch" style="display: flex;">
				<span style="margin-right: 20rpx;">批次号</span>
				<u--input 
					placeholder="请输入/扫描" 
					v-model="query.materialBatch" 
					suffixIcon="scan" 
					suffixIconStyle="font-size: 68rpx"
					style="flex: 1;">
				</u--input>
			</u-form-item>
			<u-form-item label="" prop="container">
				<span style="margin-right: 50rpx;">容器</span>
				<u-tag v-if="needContainer !== ''" style="margin-right: 50rpx;" :text="needContainer" type="warning" plain plainFill size="medium"></u-tag>
				<u-tag v-else style="margin-right: 50rpx;" text="无" type="error" plain plainFill size="medium"></u-tag>
				<span style="margin-right: 50rpx;">容器位置</span>
				<span style="margin-right: 50rpx;">??????</span>
			</u-form-item>
			<u-form-item label="" prop="newContaner" style="display: flex;">
				<span style="margin-right: 20rpx;">容器码</span>
				<u--input
					placeholder="请输入/扫描" 
					v-model="query.newContainer" 
					suffixIcon="scan" 
					suffixIconStyle="font-size: 68rpx"
					style="flex: 1;"
					:disabled="needContainer === ''"
				>
				</u--input>
			</u-form-item>
			<u-form-item label="" prop="storage" style="display: flex;">
				<span style="margin-right: 20rpx;">储位码</span>
				<u--input
					placeholder="请输入/扫描" 
					v-model="query.storage" 
					suffixIcon="scan" 
					suffixIconStyle="font-size: 68rpx"
					style="flex: 1;"
				>
				</u--input>
			</u-form-item>
			<u-form-item label="" prop="qty" style="display: flex;">
				<span style="margin-right: 50rpx;">数量</span>
				<u--input 
					placeholder="请输入数量" 
					v-model="query.qty" 
					style="flex: 1;">
				</u--input>
			</u-form-item>
			<u-form-item label="" prop="alreadyQty" style="display: flex;">
				<span style="margin-right: 50rpx;">已入库数量</span>
				<span style="margin-right: 50rpx;">100</span>	
			</u-form-item>
			<u-form-item label="" prop="orderQty" style="display: flex;">
				<span style="margin-right: 50rpx;">入库单数量</span>
				<span style="margin-right: 50rpx;">200</span>
			</u-form-item>
			<u-form-item label="" prop="toStorage" style="display: flex;">
				<span style="margin-right: 80rpx;">目的储位</span>
				<span style="margin-right: 50rpx;">XXXXXX</span>
			</u-form-item>
		</u--form>
		<view style="display: flex;">
			<u-button style="margin-right: 20rpx;" type="primary" text="确认" @click="submit"></u-button>
			<u-button style="margin-right: 20rpx;" type="primary" text="紧急发料" @click="submit"></u-button>
			<u-button style="" type="primary" text="入库单完成" @click="submit"></u-button>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				query: {
					materialCode: '',
					materialBatch: ''
				},
				needContainer: ''
			};
		},
		onLoad(options) {
			uni.$on('scancodedate',(data) => this.getCode(data.code))
		},
		onUnload() {  
		  // 移除监听事件      
		  uni.$off('scancodedate')
		},
		methods: {
			getCode(code) {
				// this.query.containerCode = code
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>
